package org.grow.controller;


import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

/**
 * @Author: xwg
 * @CreateDate: 21-8-16
 */

@RestController
public class ProviderController {

    @PutMapping("/pc/{id}")
    public String getFullName(@PathVariable("id") String id){
        int i = 0;
        try {
            i = Integer.parseInt(id);
        } catch (NumberFormatException e) {
             throw new NumberFormatException("自定义的数字异常信息");
        }
//        NumberFormatException
        return "zhangsan"+i*10;
    }

    @GetMapping("/pc/showTime")
    public String showTime(){
        return LocalDateTime.now().
                format(DateTimeFormatter.
                        ofPattern("yyyy----MM----dd::: hhmmss"));
    }
}
